package ioc.v2;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class Student {
    private final StudentComponent studentComponent;

    public Student(@Qualifier("studentComponent") StudentComponent studentComponent) {
        this.studentComponent = studentComponent;
    }

    @Bean({"s1","s2"})
    public StudentComponent s1() {
        return new StudentComponent("1",1);
    }
    @Bean("s3")
    public StudentComponent s2() {
        return new StudentComponent("2",2);
    }

    @Bean
    public String name(){
        return "lisi";
    }
    @Bean
    public StudentComponent s4(String name) {
        return new StudentComponent(name,2);
    }
}
